

*** Load ACS data

	infile using "R12561009.dct", using("R12561009_SL050.txt") clear
	
	renvars, lower

	keep a10027_002 a10027_003 a10027_004 a10027_005 a10027_006 a10027_007 a10027_008 a10027_009 a10027_010 a10027_011 a10027_012 a10027_013 a10027_014 a10027_015 a10027_016 a10027_017
	
	rename a10027_017 a10027_001
	order a10027_001
	
	collapse (sum) a*
	
	gen t = _n
	
	reshape long a, i(t) j(n) string
	
	drop t n
	
	gen min = .
	gen max = .
	order min max a
	
	replace min = max(0,100*(_n-2)) if _n < 13
	replace max = 100*(_n-1) if _n < 12

	replace min = min[_n-1] + 500 if !missing(min[_n-1]) & missing(min)
	replace max = max[_n-1] + 500 if !missing(max[_n-1]) & missing(max)
	replace max = 9999999 if max == 3500
	
	egen asum = sum(a)
	gen sh_hou_cost = a / asum
	drop a asum
	
	save "$data/raw/dist_hou_cost.dta", replace
